package com.punch.common.utils;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class PhoneUtils {

    /**
     * 判断手机号码合法性
     *
     * @param phone
     * @return
     */
    public static boolean isPhone(String phone) {
        if (phone == null || "".equals(phone)) {
            return false;
        }
        if (phone.length() != 11) {
            return false;
        }
        String regex = "^1[3456789]\\d{9}$";
        Pattern p = Pattern.compile(regex);
        Matcher m = p.matcher(phone);
        boolean isMatch = m.matches();
        return isMatch;
    }
}
